package modelscsw.restaurant.android.activity;

import modelscsw.restaurant.android.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class RestaurantMainActivity extends Activity {

	private int SEARCH_ACTIVITY = 0;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.restaurant_menu, menu);
		return true;
	}

	private void searchRestaurant() {
		Intent i = new Intent(this, SearchActivity.class);
		startActivityForResult(i, SEARCH_ACTIVITY);
	}

	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		switch (item.getItemId()) {
		case R.id.itemSearch:
			searchRestaurant();
			return true;
		default:
			return super.onMenuItemSelected(featureId, item);
		}

	}

}